FROM golang:1.17.1-alpine3.14 as builder
WORKDIR /apps
COPY . .

ENV GOPROXY=https://goproxy.cn

RUN rm -f go.mod
RUN go mod init demo \
	&& go mod tidy \
	&& CGO_ENALBED=0 GOOS=linux go build -o httpserver-metrics


FROM alpine:latest as prod
WORKDIR /apps
COPY --from=builder /apps/httpserver-metrics /apps
EXPOSE 9900
CMD ["./httpserver-metrics"]